<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simTubeOpen</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simTubeOpen" id="simTubeOpen"></a>simTubeOpen / sim.tubeOpen </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Opens a tube for communication within CoppeliaSim. A tube is similar to a bidirectional communication pipe. Messages written on one side can be read on the other side in the same order as they were written. Tubes opened via a script will automatically close upon simulation end. A scene switch will close all communication tubes and tube handles will not be valid anymore. See also <a href="simTubeClose.htm">sim.tubeClose</a>, <a href="simTubeWrite.htm">sim.tubeWrite</a>, <a href="simTubeRead.htm">sim.tubeRead</a>, <a href="simTubeStatus.htm">sim.tubeStatus</a>, <a href="simSendData.htm">sim.sendData</a> and <a href="simReceiveData.htm">sim.receiveData</a>.<br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simTubeOpen(simInt dataHeader,const simChar* dataName,simInt readBufferSize,simBool notUsedButKeepFalse)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>dataHeader</strong>: number indicating who &quot;designed&quot; the communication message. Always use the same header (because only you will know the meaning of the message) and stick to it. The best is to use the serial number of your CoppeliaSim copy (check the &quot;Help&quot; menu, in the &quot;About&quot; item for the serial number). Otherwise, you risk collision with other developer's messages which might use the same header as yours.<br>
</div>
<div><strong>dataName</strong>: name indicating the type of message. A tube will only be able to connect if its two sides have the same dataHeader and dataName<br>
</div>
<div><strong>readBufferSize</strong>: the number of data packets that can be stored in the input buffer of this side of the tube<br>
</div>
<div><strong>notUsedButKeepFalse</strong>: not used. Keep to false.<br>
</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 if operation was not successful, otherwise the tube handle.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>number tubeHandle=sim.tubeOpen(number dataHeader,string dataName,number readBufferSize)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 
</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
